package com.sx.first.biz;

import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.sx.first.biz.MaterialBiz;
import com.sx.first.dao.MaterialDAO;
import com.sx.first.model.Material;

@Service("materialBiz")
@Scope("prototype")
public class MaterialBiz  {
	private MaterialDAO materialDAO;
	
	public void setMaterialDAO(MaterialDAO materialDAO) {
		this.materialDAO = materialDAO;
	}

	public  List<Material> findAll(){
		return materialDAO.findAll();
	}

	public  void save(Material mat) {
		materialDAO.save(mat);
		
	}

	public  Material findById(int matId) {
		return materialDAO.findById(matId);
	}

	public void delete(int matId) {
		materialDAO.delete(materialDAO.findById(matId));
		
	}

	public void update(Material mat) {
		materialDAO.update(mat);
		
	}
	

}
